package com.tzbank.wisdom.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.tzbank.wisdom.service.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;


/**
 * 上传控制器
 *
 */
@Api(tags={"上传控制器"})
@Slf4j
@RequestMapping("pic")
@RestController
public class UploadController {
    
	@Autowired
    private UploadService uploadService;
	
	/**
	 * 单个上传
	 * @param @RequestParam String identityCode,@RequestParam String files,@RequestParam String busino
	 * @return
	 */
    @ResponseBody
    @PostMapping(value="/upload")
    @ApiOperation(value = "上传", notes = "上传接口")
    public Map<String,Object> uploadOne(@RequestBody Map<String ,String> map) {
    	//log.info("入参："+JSONObject.fromObject(map));
    	return uploadService.upload(map.get("identityCode"), map.get("files"), map.get("busino"));
    }
    
   
    /**
	 * 上传身份证正反面
	 * @param 
	 * @return
	 * @RequestParam String identityFront ,@RequestParam String busino,@RequestParam String identityOpposite
	 */
  @ResponseBody
    @PostMapping(value="/uploadList")
    @ApiOperation(value = "上传", notes = "上传接口")
    public Map<String,Object> currentToFDTransfer(@RequestBody Map<String ,String> map  ) {
	  	//log.info("入参："+JSONObject.fromObject(map));
    	return uploadService.uploadList(map.get("identityFront"), map.get("busino"), map.get("identityOpposite"));
    }
    
    
}
